package com.shortvedio.search.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shortvedio.base.mapper.FavoritesMapper;
import com.shortvedio.base.model.Result;
import com.shortvedio.base.model.po.Favorites;
import com.shortvedio.search.service.FavoritesServcie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FavoritesServiceImpl implements FavoritesServcie {

    @Autowired
    private FavoritesMapper favoritesMapper;

    @Override
    public Result getFavoritesList(Long userId) {//获取收藏夹
        LambdaQueryWrapper<Favorites> favoritesLambdaQueryWrapper = new LambdaQueryWrapper<>();
        favoritesLambdaQueryWrapper.eq(Favorites::getUserId,userId);
        List<Favorites> favorites = favoritesMapper.selectList(favoritesLambdaQueryWrapper);
        return Result.success(favorites);
    }
}
